from sqlmodel import SQLModel, Field, Column, Integer, String, DateTime, Date
from datetime import datetime, date


class EmpTable(SQLModel, table=True):
    __tablename__ = "emp"
    id: int = Field(default=None, sa_column=Column("id", Integer, primary_key=True))
    username: str = Field(sa_column=Column("username", String, unique=True))
    password: str = Field(sa_column=Column("password", String))
    name: str = Field(sa_column=Column("name", String))
    gender: int = Field(sa_column=("gender", Integer))
    image: str = Field(sa_column=Column("image", String))
    job: int = Field(sa_column=Column("job", Integer))
    entrydate: date = Field(sa_column=Column("entrydate", Date))
    deptId: int = Field(sa_column=Column("dept_id", Integer))
    createTime: datetime = Field(
        default_factory=datetime.now,
        sa_column=Column("create_time", DateTime, default=datetime.now),
    )
    updateTime: datetime = Field(
        sa_column=Column("update_time", DateTime, default=datetime.now),
    )
